export default {
    httpRequst: function (url, data, contentType, doSuccess, doFail, doComplete) {
        wx.request({
            url: url,
            data: data,
            method: "POST",
            // header: {
            //     "content-type": contentType
            //     // "Content-Type": contentType
            // },
            header: {
                "content-type": "application/json", "Caller": "kmerApiSDK"
            },
            success: function (res) {
                if (typeof doSuccess == "function") {
                    doSuccess(res);
                }
            },
            fail: function () {
                if (typeof doFail == "function") {
                    doFail();
                }
            },
            complete: function (res) {
                if (typeof doComplete == "function") {
                    doComplete(res);
                }
            }
        });
    },
    postJson: function (url, data, doSuccess, doFail, doComplete) {
        var type = "application/json";
        this.httpRequst(url, data, type, doSuccess, doFail, doComplete);
    },
    postData: function (url, data, doSuccess, doFail, doComplete) {
        var type = "application/x-www-form-urlencoded";
        this.httpRequst(url, data, type, doSuccess, doFail, doComplete);
    },
}
